home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / prtcs155.zip / FTPNOTE.REX < prev    next >
OS/2 REXX Batch file  |  1994-01-14  |  1KB  |  63 lines

  1. /**/
  2. v="$VER: FTPtoNOTE Rexx Set Comment to Short in AmiNet ReadMe Williamson 54.01"
  3. ftpdir="DL:ftp/"
  4. /*
  5.     Reads AmiNet *.readme file and sets the filenote of the file to the
  6.     short description
  7. */
  8.     if ~show('L',"RexxDosSupport.library") then do
  9.         if ~addlib("RexxDosSupport.library", 2, -30, 0) then do
  10.             say "Couldn't access RexxDosSupport.library !"
  11.             say "Will use slow env: variable read/write procedures"
  12.             REXXDOS=0
  13.         end
  14.     end
  15.  
  16.     filelist=showdir(ftpdir,'F')
  17.     i=1
  18.     j=1
  19.     do x=1 until x=words(filelist)
  20.         fn=word(filelist,x)
  21.         if upper(right(fn,7))='.README' then do
  22.             rdm.i=fn
  23.             i=i+1
  24.         end;else do
  25.             ftps.j=fn
  26.             j=j+1
  27.         end
  28.     end
  29.  
  30. readmes=i-1
  31. ftpfiles=j-1
  32.  
  33. do i=1 to readmes
  34.     if ~open('f',ftpdir||rdm.i,'r') then iterate
  35.     do while ~eof('f')
  36.         line=COMPRESS(readln('f'),'"')
  37.         if upper(left(line,5))="SHORT" then do
  38.             note=subword(line,2)
  39.             call findmatch(rdm.i)
  40.         end
  41.     end
  42.     call close('f')
  43. end
  44. exit
  45.  
  46. findmatch:
  47.     rfile=upper(arg(1))
  48.     pattern=delstr(rfile,index(rfile,'.README'))||"#?"
  49.     say pattern
  50.     do match=1 to ftpfiles
  51.         if MatchPattern(pattern,ftps.match,"N") then do
  52.             say "File:" ftps.match
  53.             say "Desc:" note
  54.             address COMMAND 'FileNote' ftpdir||ftps.match '"'note'"'
  55.             return 1
  56.         end
  57.     end
  58.     Say 'Found no file for 'rfile
  59. return 0
  60.  
  61.  
  62.  
  63.